package com.star.langchain.learn.aiservice;

import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.SystemMessage;
import dev.langchain4j.service.UserMessage;
import dev.langchain4j.service.spring.AiService;
import reactor.core.publisher.Flux;

import static dev.langchain4j.service.spring.AiServiceWiringMode.EXPLICIT;

/**
 * AI服务接口，提供流式聊天功能
 *
 * @author star
 */
@AiService(wiringMode = EXPLICIT, chatModel = "chatModel", streamingChatModel = "streamingChatModel",
        chatMemoryProvider = "chatMemoryProvider",
        contentRetriever = "contentRetriever",
        tools = {"bizTools", "dateTools"}

)
public interface StreamingAiService {

    /**
     * 聊天方法
     *
     * @param message 用户消息
     * @return 流式响应
     */
    @SystemMessage("你是阿星的私人助手，回答各种代码问题")
    Flux<String> chat(@UserMessage String message, @MemoryId Long memoryId);

}
